<template>
	<!-- 营地订单 -->
	<view class="outtor">
		<view class="menu_title">
			<view class="bottom_border" @click="index = 1"><text :class="index==1?'cor':''">全部订单</text></view>
			<view class="bottom_border" @click="index = 2"><text :class="index==2?'cor':''">待支付</text></view>
			<view class="bottom_border" @click="index = 3"><text :class="index==3?'cor':''">未送达</text></view>
			<view class="bottom_border" @click="index = 4"><text :class="index==4?'cor':''">已送达</text></view>
		</view>
		<!-- <view class="order_content" v-if="orders.length==0">
			<text>暂无数据</text>
		</view> -->
		<view class="order_detail">
			<view class="order_detail_content" v-if="orders.length!=0" v-for="order in orders">
				<view class="content_left">
					<image :src="order.url"></image>
				</view>
				<view class="content_right">
					<view class="content_right_top">
						
					</view>
					<view class="content_right_bottom">
						<view>
							<view >
								<text>{{order.foodName}}</text>
							</view>
						</view>
						
						<view>
							<view>
								<text>订餐时间：</text><text>{{order.orderTime}}</text>
							</view>
						</view>
						<view>
							<view>
								<text>数量：</text><text>{{order.number}}</text><text>份</text>
							</view>
						</view>
						<view>
							<text>营地地点：{{order.campname}}</text>
						</view>
						<view>
							<text>车牌号：{{order.license}}</text>
						</view>
						<view>
							<text>总价：￥{{order.total}}元</text>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				index: 1,
				orders: [],
			}
		},
		onLoad() {
			this.selectOrder()
		},
		methods: {
			selectOrder() {
				console.log(123214)
				uni.request({
					url: this.webUrl+'selectAllFoodOrderByUserId?status=' + this.index+'&userId=1',
					success: (res) => {
						console.log(res.data.list)
						this.orders = res.data.list;
					}
				});
			}
		},
		watch: {
			'index': function() {
				this.selectOrder();
			}
		}
	}
</script>

<style lang="scss">
	.outtor {
		background-color: #DCDDDD;
		min-height: 1250rpx;
		width: 750rpx;

		.order_detail {
			width: 100%;
			font-size: 30rpx;
			background-color: white;
			position: relative;
			margin-top: 10rpx;
			.order_detail_content {
				border-top: 1rpx solid #AAAAAA;
				width: 100%;
				height: 250rpx;

				.content_left {
					width: 40%;
					padding-top: 20rpx;
					padding-left: 20rpx;

					image {
						width: 100%;
						height: 170rpx;
					}
				}

				.content_right {
					width: 70%;
					position: relative;
					top: -170rpx;
					left: 340rpx;
					text-align: center;
					font-size: 28rpx;
					margin-left: 20rpx;

					.content_right_top {
						width: 100%;
						height: 5rpx;
						display: flex;
						flex-wrap: wrap;
						.quan {
							width: 120rpx;
							line-height: 50rpx;
						}
						.blue {
							color: #4CA2FF;
						}
					}

					.content_right_bottom {
						width: 100%;
						height: 10rpx;
						text-align: left;
					}
				}
			}
		}

		.order_content {
			width: 750rpx;
			height: 220rpx;
			font-size: 30rpx;
			text-align: center;
			line-height: 220rpx;
			background-color: white;
			margin-top: 10rpx;
		}

		.menu_title {
			width: 750rpx;
			height: 100rpx;
			background-color: #464646;
			display: flex;
			flex-wrap: wrap;
			justify-content: space-around;
			line-height: 100rpx;
			color: white;
			font-size: 30rpx;
			text-align: center;

			.bottom_border {
				width: 25%;
				height: 100rpx;

				.cor {
					color: #FF3333;
				}
			}
		}
	}
</style>
